﻿@model Bonobo.Git.Server.Models.TeamDetailModel
@{
    ViewBag.Title = Resources.Team_Detail_Title;
}
@if (Model == null)
{
    @Html.Partial("~/Views/Shared/_ItemNotFound.cshtml")
}
else
{
    <h1>@Model.Name</h1>

    <div class="pure-form pure-form-aligned detail">
        <fieldset>
            <div class="pure-control-group">
                @Html.LabelFor(m => m.Name)
                <span>@Model.Name</span>
            </div>
            <div class="pure-control-group">
                @Html.LabelFor(m => m.Description)
                <span>@Model.Description</span>
            </div>
            <div class="pure-control-group">
                @Html.LabelFor(m => m.Members)
                <span>
                    @for (int i = 0; i < Model.Members.Length; i++)
                    {
                        @Html.ActionLink(@Model.Members[i].DisplayName, "Detail", "Account", new { id = @Model.Members[i].Id}, new { title = @Model.Members[i].Username })if (i + 1 != Model.Members.Length)
                        {<text>, </text>}
                    }
                </span>
            </div>
            <div class="pure-control-group">
                @Html.LabelFor(m => m.Repositories)
                <span>
                    @for (int i = 0; i < Model.Repositories.Length; i++)
                    {
                        @Html.ActionLink(@Model.Repositories[i].DisplayName, "Detail", "Repository", new { id = @Model.Repositories[i].Id }, null)if (i + 1 != Model.Repositories.Length)
                        {<text>, </text>}
                    }
                </span>
            </div>
            <div class="pure-controls">
                <a class="pure-button" href="@Url.Action("Index")"><i class="fa fa-long-arrow-left"></i> @Resources.Team_Detail_Back</a>
                @if (User.IsInRole(Definitions.Roles.Administrator) && !Model.IsReadOnly)
                {
                    <a class="pure-button" href="@Url.Action("Edit", new { id = Model.Id })"><i class="fa fa-pencil-square-o"></i> @Resources.Team_Detail_Edit</a>
                    <a class="pure-button" href="@Url.Action("Delete", new { id = Model.Id })"><i class="fa fa-trash-o"></i> @Resources.Team_Detail_Delete</a>
                }
            </div>

        </fieldset>
    </div>
}
